﻿using MediatR;
using T.Contract.API.Application.Command.ContractCommand;
using T.Contract.Domain.T.Contract.Model;
using T.Contract.Repository.Interface;

namespace T.Contract.API.Application.CommandHandlers.ContractHandler
{
    public class ContractCreateCommandHandler : IRequestHandler<ContractCreateCommand, int>
    {
        protected readonly IContractRepository contractRepository;

        public ContractCreateCommandHandler(IContractRepository contractRepository)
        {
            this.contractRepository = contractRepository;
        }

        public Task<int> Handle(ContractCreateCommand request, CancellationToken cancellationToken)
        {
            return contractRepository.AddAsync(request);

        }
    }
}
